#include  <cstdio>

int main(int argc, char *argv[])
{
	int n,a[5];
	scanf("%d",&n);

	while( n-- )
	{
		scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]);
		int t;
		if( a[0]-a[1] == a[1]-a[2] )
			a[4] = a[3] + a[3] - a[2];
		else
			a[4] = a[3] * (a[3] / a[2]);

		for( int i = 0; i < 4 ; ++i )
			printf("%d ",a[i]);

		printf("%d\n",a[4]);
	}
}
